import {
    createApp
} from 'vue';

//element
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css'

//重置样式
import '../theme/reset.css';

//动画插件
import animated from 'animate.css'
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
NProgress.configure({
    easing: 'ease',
    speed: 500,
    showSpinner: false,
    trickleSpeed: 200,
    minimum: 0.3
})
//路由监听
router.beforeEach((to, from, next) => {
    NProgress.start();
    next();
});

// 自适应
import 'lib-flexible'

import App from './App.vue';
import router from '../src/router/index'

// 全局组件声明 vue2注册
// import componentsUse from './components/componentsUse'
import tableCrud from './components/common/tableCrud/index.vue'
import './assets/style/index.scss'
//页面顶部title修改
router.beforeEach((to, from, next) => {
    //跳转新页面回到顶部;
    window.scrollTo(0, 0);
    //修改浏览器的title;
    if (to.meta.title) {
        document.title = '死亡管理系统' + ' - ' + to.meta.title;
    }
    next();
})

//路由跳转结束
router.afterEach(() => {
    NProgress.done()
})

const app = createApp(App)
app.use(animated)
app.use(ElementPlus)
app.use(router)
app.component('table-crud',tableCrud)


app.mount('#app')